/*
 * @Author: chenbolin@msn.cn
 * @Date: 2023-02-27 15:06:21
 * @LastEditors: chenbolin@msn.cn
 * @LastEditTime: 2023-10-10 14:53:22
 * @FilePath: \mfReceiver\src\Hal\HalDAC.c
 * @Description: 
 * 
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 */
#include "HalDAC.h"
#include "stm32f4xx_hal.h"

extern DAC_HandleTypeDef hdac;
void HalDACSetValue(HalDACChannel_t ch, unsigned short value)
{
    unsigned int dacCH = (ch == HAL_DAC_CH_RPM) ? DAC_CHANNEL_1 : DAC_CHANNEL_2;
    HAL_DAC_SetValue(&hdac, dacCH, DAC_ALIGN_12B_R, value);
}

void HalDACInitialize(void)
{
    HAL_DAC_Start(&hdac, DAC_CHANNEL_1);
    // HAL_DAC_Start(&hdac, DAC_CHANNEL_2);
}

